﻿Public Class TextAndMovementRequest
    Inherits RequestBase
    Implements IRequest

#Region "Member Fields"
    Private _messageText As System.String
    Private _voice As Lookups.VoiceEnum
    Private _messageLifeInSeconds As UInt32
    Private _leftEarLocation As UInt32
    Private _rightEarLocation As UInt32
#End Region

#Region "Properties"
    Public Property MessageText() As System.String
        Get
            Return _messageText
        End Get
        Set(ByVal value As System.String)
            _messageText = value
        End Set
    End Property

    Public Property Voice() As Lookups.VoiceEnum
        Get
            Return _voice
        End Get
        Set(ByVal value As Lookups.VoiceEnum)
            _voice = value
        End Set
    End Property

    Public Property MessageLifeInSeconds() As UInt32
        Get
            Return _messageLifeInSeconds
        End Get
        Set(ByVal value As UInt32)
            _messageLifeInSeconds = value
        End Set
    End Property
    Public Property LeftEarLocation() As UInt32
        Get
            Return _leftEarLocation
        End Get
        Set(ByVal value As UInt32)
            If value > 16 Then
                Throw New ArgumentOutOfRangeException("LeftEarLocation", "LeftEarLocation cannot be greater than 16")
            End If
            _leftEarLocation = value
        End Set
    End Property

    Public Property RightEarLocation() As UInt32
        Get
            Return _rightEarLocation
        End Get
        Set(ByVal value As UInt32)
            If value > 16 Then
                Throw New ArgumentOutOfRangeException("RightEarLocation", "RightEarLocation cannot be greater than 16")
            End If
            _rightEarLocation = value
        End Set
    End Property
#End Region

#Region "Constructors"
    Public Sub New()

    End Sub

    Public Sub New(ByVal serialNumber As String, ByVal token As Int32, ByVal messageText As String, ByVal voice As String, ByVal messageLifeInSeconds As UInt32, ByVal leftEarLocation As UInt32, ByVal rightEarLocation As UInt32)
        MyBase.SerialNumber = serialNumber
        MyBase.Token = token
        Me.MessageText = messageText
        Me.Voice = voice
        Me.MessageLifeInSeconds = messageLifeInSeconds
        Me.LeftEarLocation = leftEarLocation
        Me.RightEarLocation = rightEarLocation
    End Sub
#End Region

#Region "IMessage Implementation"
    Public Function GetQueryString() As String Implements IRequest.GetQueryString
        Dim query As New QueryBuilder(SerialNumber, Token)
        query.SetVoice(Me.Voice)
        query.SetMessageLifeInSeconds(Me.MessageLifeInSeconds)
        query.SetMessageText(Me.MessageText)
        query.SetLeftEarPosition(Me.LeftEarLocation)
        query.SetRightEarPosition(Me.RightEarLocation)
        Return query.ToString
    End Function
#End Region

End Class
